<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>endnetent</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4>NAME</h4><blockquote>
endnetent, getnetbyaddr, getnetbyname, getnetent, setnetent - network database functions
</blockquote><h4>SYNOPSIS</h4><blockquote>
<pre><code>

#include &lt;<a href="netdb.h.html">netdb.h</a>&gt;

void endnetent(void);

struct netent *getnetbyaddr(in_addr_t <I>net</I>, int <I>type</I>);

struct netent *getnetbyname(const char *<I>name</I>);

struct netent *getnetent(void);

void setnetent(int <I>stayopen</I>);
</code>
</pre>
</blockquote><h4>DESCRIPTION</h4><blockquote>
The
<i>getnetbyaddr()</i>,
<i>getnetbyname()</i>
and
<i>getnetent()</i>,
functions each return a pointer to a <B>netent</B> structure, the members of
which contain the fields of an entry in the network database.
<p>
The
<i>getnetent()</i>
function reads the next entry of the database, opening a connection to the
database if necessary.
<p>
The
<i>getnetbyaddr()</i>
function searches the database from the beginning, and finds the first entry
for which the address family specified by <I>type</I> matches the
<B>n_addrtype</B> member and the network number <I>net</I> matches
the <B>n_net</B> member, opening a connection to the database if necessary.
The <I>net</I> argument is the network number in host byte order.
<p>
The
<i>getnetbyname()</i>
function searches the database from the beginning and finds the first entry
for which the network name specified by <I>name</I> matches the <B>n_name</B>
member, opening a connection to the database if necessary.
<p>
The
<i>setnetent()</i>
function opens and rewinds the database.  If the <I>stayopen</I> argument is
non-zero, the connection to the net database will not be closed after each
call to
<i>getnetent()</i>
(either directly, or indirectly through one of the other
<i>getnet*()</i>
functions).
<p>
The
<i>endnetent()</i>
function closes the database.
</blockquote><h4>RETURN VALUE</h4><blockquote>
On successful completion,
<i>getnetbyaddr()</i>,
<i>getnetbyname()</i>
and
<i>getnetent()</i>,
return a pointer to a <B>netent</B> structure if the requested entry was found,
and a null pointer if the end of the database was reached or the requested
entry was not found.  Otherwise, a null pointer is returned.
</blockquote><h4>ERRORS</h4><blockquote>
No errors are defined.
</blockquote><h4>APPLICATION USAGE</h4><blockquote>
The
<i>getnetbyaddr()</i>,
<i>getnetbyname()</i>
and
<i>getnetent()</i>,
functions may return pointers to static data, which may be overwritten by
subsequent calls to any of these functions.
<p>
These functions are generally used with the Internet address family.
</blockquote><h4>SEE ALSO</h4><blockquote>
<i><a href="netdb.h.html">&lt;netdb.h&gt;</a></i>.
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>
